package com.liuqing.www.java基础知识;

import java.util.EnumMap;
import java.util.HashMap;
import java.util.Map;

public class Emun {
public enum people{
	春天,夏天,秋香,博湖
}
public enum people1{
	people1("来了",110),
	people2("来了2",220),
	people3("来了2",220);
	private String name;
	private int age;
	/**
	 * 只允许为private访问级别
	 * @param name
	 * @param age
	 */
	private people1(String name,int age){
		this.name=name;
		this.age=age;
	}
}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		System.out.println(people1.people2.name);
		for(people1 p1:people1.values()){
			System.out.println(p1.name);
		}
		//比如用于学生的成绩评定等，共用的对象
		people1 p=people1.people3;
		switch(p){
		case people1:
		case people2:
		case people3:
		}
		Map<people1, String> map=new HashMap<people1, String>();
		EnumMap<people1, String> antMessages = //key值只允许为enum，故不会 ConcurrentModificationException，高效
		    new EnumMap<people1, String>(people1.class);
		antMessages.put(people1.people1, "people1str");
		map.put(people1.people1, "people1str");
		System.out.println(antMessages.get(people1.people1));
		System.out.println(map.get(people1.people1));

	}

}
class hum{
	public String name;
	public int age;
}
